package cn.sise.edu.crm.service.impl;

import cn.sise.edu.crm.domain.TraceCustomerHistry;
import cn.sise.edu.crm.mapper.TraceCustomerHistryMapper;
import cn.sise.edu.crm.query.QueryObject;
import cn.sise.edu.crm.service.ITraceCustomerHistryService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by chen on 2019/11/3.
 */
@Service
public class TraceCustomerHistryServiceImpl implements ITraceCustomerHistryService {
    @Autowired
    private TraceCustomerHistryMapper traceCustomerHistryMapper;

    @Override
    public void insert(TraceCustomerHistry traceCustomerHistry) {
        traceCustomerHistryMapper.insert(traceCustomerHistry);
    }


    @Override
    public void update(TraceCustomerHistry traceCustomerHistry) {
        traceCustomerHistryMapper.updateByPrimaryKey(traceCustomerHistry);
    }

    @Override
    public TraceCustomerHistry selectById(Long id) {
        return traceCustomerHistryMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<TraceCustomerHistry> selectAll() {
        return traceCustomerHistryMapper.selectAll();
    }

    @Override
    public PageInfo<TraceCustomerHistry> query(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        return new PageInfo<>(traceCustomerHistryMapper.selectForList(qo));
    }
}
